/**
 * Created by JustinChow on 2016/11/14.
 */

"use strict";

function FakeSocket(gameServer) {
    this.server = gameServer;
    this.playerTracker = null;
    this.packetHandler = null;
}

module.exports = FakeSocket;

FakeSocket.prototype.sendPacket = function (packetId, msg) {

};

FakeSocket.prototype.close = function(error) {
    if (this.playerTracker.props && this.playerTracker.props.length > 0) {
        this.playerTracker.props.forEach(prop => {
            this.server.removeNode(prop);
        });
    }
    if (this.playerTracker.player) this.server.removeNode(this.playerTracker.player);

    var index = this.server.clients.indexOf(this);
    if (index != -1) this.server.clients.splice(index, 1);
};